/* (C) 2009 by Andrea Franceschini <andrea.franceschini@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef CHECKBUTTONWIDGET_H_
#define CHECKBUTTONWIDGET_H_

#include <QFont>
#include <QString>

#include "../includes/Widget.h"

namespace Doodle {
class CheckButtonWidget : public Widget {
	Q_OBJECT

public:
	CheckButtonWidget();
	CheckButtonWidget(Widget*);

	const QString name() const { return QString("CheckButtonWidget"); }

	virtual void render(QPainter*);

	virtual void setSize(float, float);
	virtual QString text() const { return _text; }
	virtual void setText(QString);

	bool isChecked() const { return _checked; }
	void setChecked(bool checked = true) { _checked = checked; }

signals:
	void tapped(int);
	void checked();
	void unchecked();

public slots:
	void tap(int);
	void check();
	void uncheck();

protected:
	bool _checked;

	QFont _font;
	QString _text;
};

}

#endif /* CHECKBUTTONWIDGET_H_ */
